<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>文章列表 - FinalCMS Admin</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

<link rel="stylesheet" href="${ctx}/css/bootstrap.min.css" />
<link rel="stylesheet" href="${ctx}/css/font-awesome.min.css" />
<link rel="stylesheet" href="${ctx}/css/jquery-ui.custom.min.css" />
<!--[if lte IE 9]>
<link rel="stylesheet" href="${ctx}/css/fc-part2.min.css" />
<![endif]-->
<link rel="stylesheet" href="${ctx}/css/fc-skins.min.css" />
<link rel="stylesheet" href="${ctx}/css/fc-rtl.min.css" />
<link rel="stylesheet" href="${ctx}/css/fc-fonts.css" />
<link rel="stylesheet" href="${ctx}/css/fc.min.css" />
<link rel="stylesheet" href="${ctx}/css/fc-custom.css" />
<!--[if lte IE 9]>
 <link rel="stylesheet" href="${ctx}/css/fc-ie.min.css" />
<![endif]-->
<link rel="stylesheet" href="${ctx}/css/bootstrap-datetimepicker.min.css" />
<script type="text/javascript" src='${ctx}/js/jquery1.11.0.min.js'></script>
<!--[if lte IE 8]>
<script src="${ctx}/js/html5shiv.js"></script>
<script src="${ctx}/js/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
	var ctx = "${url}";
</script>
</head>

<body class="no-skin">
<?include("../../inc/menu.html",{current:"post_recycle"}){}?>
<div class="main-content">
	<div class="breadcrumbs" id="breadcrumbs">
		<ul class="breadcrumb">
			<li><i class="ace-icon fa fa-home home-icon"></i> <a
				href="${ctx}/admin/account/dashboard">首页</a></li>
			<li class="active">文章回收站</li>
		</ul>
	</div>

	<div class="page-content">
		<div class="page-header">
			<h1>文章回收站</h1>
		</div>
		<div class="row">
			<form action="${ctx}/admin/post" id="frm" method="post" class="form-inline">
				<div class="alert alert-success" style="padding: 5px; margin-bottom: 0px;">
					<div class="form-group">
						<label for="category">分类</label>
						<select name="category" id="category" class="form-control input-sm">
							<option value="">顶级栏目</option>
							<?for (c in categoryList!) {?>
							<option value="${c.id!}" <?if(cid! == c.id!){?>selected<?}?>>${c.title!}</option>
								<? for(c2 in c.sub!) {?>
									<option value="${c2.id!}" <?if(cid! == c2.id!){?>selected<?}?>>----${c2.title!}</option>
									<? for(c3 in c2.sub!) {?>
										<option value="${c3.id!}" <?if(cid! == c3.id!){?>selected<?}?>>--------${c3.title!}</option>
									<?}?>
								<?}?>
							<?}?>
						</select>
					</div>
					<div class="form-group">
						<label>发布时间</label>
						<div class="input-daterange input-group">
							<input type="text" name="createTimeMin" readonly="readonly" class="input-sm form-control date-picker"/>
							<span class="input-group-addon">
								<i class="fa fa-exchange"></i>
							</span>
							<input type="text" name="createTimeMax" readonly="readonly" class="input-sm form-control date-picker" />
						</div>
					</div>
					<div class="form-group">
						<label>标题</label>
						<input type="text" name="title" value="${title!}" class="form-control input-sm"/>
					</div> 
					<div class="form-group">
						<input type="submit" value="搜索" class="search form-control input-sm"/>
					</div>
				</div>
				<div class="alert alert-warning" style="padding: 5px; margin-bottom: 0px;">
					<div class="form-group">
						<input type="button" value="彻底删除" id="delete" class="search form-control input-sm" />
					</div>
					<div class="form-group">
						<input type="button" value="清空回收站" id="empty" class="search form-control input-sm" />
					</div>
					<div class="form-group">
						<input type="button" value="还原" id="repub" class="search form-control input-sm" />
					</div>
				</div>
				<div class="table-container col-xs-12 table_page">
					<table id="content-table"
						class="table table-striped table-bordered table-hover table_page">
						<thead>
							<tr>
								<th class="center" width="5%">
									<label class="position-relative">
										<input type="checkbox" class="ace table_check" value="${list.id!}"/>
										<span class="lbl"></span>
									</label>
								</th>
								<th class="center" width="25%">标题</th>
								<th class="center" width="10%">栏目</th>
								<th class="center" width="10%">作者</th>
								<th class="center" width="6%">状态</th>
								<th class="center" width="5%">阅读数</th>
								<th class="center" width="5%">评论数</th>
								<th class="center" width="5%">点赞数</th>
								<th class="center" width="15%">发布时间</th>
								<th class="center" width="8%">操作</th>
							</tr>
						</thead>
						<tbody>
							<?for(list in page.list!) {?>
							<tr>
								<td class="center">
									<label class="position-relative">
										<input type="checkbox" name="ids" class="ace table_check" value="${list.id!}" />
										<span class="lbl"></span>
									</label>
								</td>
								<td><a href="#" title="${list.title!}">${str.subString(list.title!,0,18)}</a></td>
								<td class="center">${categoryMap[list.category!0]}</td>
								<td class="center">${authorMap[list.author!0]}</td>
								<td class="center">${stateMap[list.state!0]}</td>
								<td class="center">${list.read_num!0}</td>
								<td class="center">${list.reply_num!0}</td>
								<td class="center">${list.favorite_num!0}</td>
								<td class="center">${list.create_time!}</td>
								<td class="center">
									<div class="action-buttons">
									<a href="${ctx}/admin/post/repub?id=${list.id!}" class="green edit-content">
										 <i class="ace-icon fa fa-flag bigger-130" title="还原"></i>
									</a> 
								</div>
								</td>
							</tr>
							<?}?>
						</tbody>
					</table>
					<#pagination page="${page!}" formId="frm" />
				</div>
			</form>
		</div>
	</div>
</div>

<?include("../../inc/footer.html"){}?>
<script type="text/javascript" src="${ctx}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${ctx}/js/fc.min.js"></script>
<script type="text/javascript" src="${ctx}/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="${ctx}/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script type="text/javascript">
jQuery(function($) {
	$('.date-picker').datetimepicker({
		todayBtn:  1,
		autoclose: 1,
		todayHighlight: 1,
		startView: 2,
		forceParse: 0,
		language: 'zh-CN',
		showMeridian: 1
	})
	$('#content-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){
		var th_checked = this.checked;//checkbox inside "TH" table header
		$(this).closest('table').find('tbody > tr').each(function(){
			if(th_checked) 
				$(this).find('input[type=checkbox]').get(0).checked = true;
			else 
				$(this).find('input[type=checkbox]').get(0).checked = false; 
		});
	});
	$("#delete").click(function(){
		var ckids = "";
		$("input:checked").each(function(){
			if($.trim($(this).val()).length > 0)
				ckids += $.trim($(this).val())+",";
    	});
		if($.trim(ckids).length > 0) {
			location.href = "${ctx}/admin/post/delete?id=" + ckids;
		}
	});
	$("#empty").click(function(){
		var ckids = "";
		$("input:checked").each(function(){
			if($.trim($(this).val()).length > 0)
				ckids += $.trim($(this).val())+",";
    	});
		if($.trim(ckids).length > 0) {
			location.href = "${ctx}/admin/post/emptyRecycle";
		}
	});
	$("#repub").click(function(){
		var ckids = "";
		$("input:checked").each(function(){
			if($.trim($(this).val()).length > 0)
				ckids += $.trim($(this).val())+",";
    	});
		if($.trim(ckids).length > 0) {
			location.href = "${ctx}/admin/post/repub?id=" + ckids;
		}
	});
});
</script>
</body>
</html>
